//
//  YWEmptyTableViewCell.m
//  maintain
//
//  Created by 烟雨云渊 on 16/12/15.
//  Copyright © 2016年 ewin. All rights reserved.
//

#import "YWEmptyTableViewCell.h"
#import "Masonry.h"
#import "YWMacro.h"
#import "UIColor+CustomColors.h"
#import "YYLabel.h"

@interface YWEmptyTableViewCell()
/*默认空的图片*/
//@property (nonatomic, weak) UIImageView* emptyImageView;
/*默认没有相关信息*/
@property (nonatomic, strong) YYLabel * messageLabel;
@end

@implementation YWEmptyTableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUpSubviews];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

- (void)setUpSubviews{
//    [self.emptyImageView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(self.contentView).offset(10);
//        make.centerX.mas_equalTo(self.contentView.mas_centerX);
//        make.size.mas_equalTo(CGSizeMake(180, 100));
//    }];
    
    [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.contentView.mas_centerX);
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
//        make.top.mas_equalTo(self.contentView.mas_bottom).offset(10);
        make.left.mas_equalTo(self.contentView).offset(20);
        make.right.mas_equalTo(self.contentView).offset(-20);
        make.height.equalTo(@150);
    }];
}

//- (UIImageView*)emptyImageView
//{
//    if (!_emptyImageView) {
//        UIImageView* emptyImageView = [[UIImageView alloc] init];
//        emptyImageView.image = [UIImage imageNamed:@"placeholder_empty"];
//        _emptyImageView = emptyImageView;
//        [self.contentView addSubview:_emptyImageView];
//    }
//    return _emptyImageView;
//}

- (YYLabel*)messageLabel
{
    if (!_messageLabel) {
        YYLabel* messageLabel = [[YYLabel alloc] init];
        messageLabel.font = kContentFont;
        messageLabel.text = @"暂时没有相关信息";
        messageLabel.textAlignment = NSTextAlignmentCenter;
        messageLabel.textColor = [UIColor customTextGrayColor];
        _messageLabel = messageLabel;
        [self.contentView addSubview:_messageLabel];
    }
    return _messageLabel;
}

@end
